package com.resource.provider.httpService;

import com.resource.provider.util.Https;
import net.sf.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;


public class OrgHttpService {

    /**
     * 根据token组织架构信息
     *
     * @return
     */
    public String getOrgByAccessToken(String token, Integer pageNum, Integer pageSize, String parentId, String keyword, String isAll) {
        StringBuilder sb = new StringBuilder();
        try{
            sb.append("token=").append(token)
                    .append("&pageNum=").append(pageNum)
                    .append("&pageSize=").append(pageSize)
                    .append("&keyword=").append(URLEncoder.encode(keyword, "utf-8"))
                    .append("&parentId=").append(parentId);
        }
        catch (UnsupportedEncodingException u) {
            u.printStackTrace();
        }
        if ("1".equals(isAll)) {
            sb.append("&isAll=1");
        }
        JSONObject json = Https.sendGet("v1/zzjg/org/select", sb.toString());

        return json.toString();
    }
    public static void main(String[] args) {


    }
}
